<div class="ZZHT-content">

	<div class="ZZHT-user-head clearfix">
		<b>华宝赎回</b>
		<span class="user_bread fr">
        当前位置：<span>首页</span>--<span>赎回</span>
		</span>
	</div>
	<div class="mains bz">
		<form name="depositForm" id="deposit" method="post" class="form-condensed nice-validator n-default" data-name="depositKaiyuan" novalidate="novalidate">
			<div class="form-group">
				<label class="control-label"><span class="text-label">华宝余额：</span><span class="kaiyuan"></span></label>
			</div>
			<div class="form-group">
				<label class="control-label"><span class="text-label">本次赎回rmb数量：</span><input type="text" name="money1" data-target="#moneyTips" onkeydown="javascript:ZZHT.isNumberdote(this)" aria-required="true"><span class="ZZHT-f999">(扣除华宝数：<span id="huabao">0</span>)</span>
			</label>
			</div>
			<div class="form-group clearfix">
				<label class="control-label fl" style="margin-left: 85px;">到账时间：</label>
				<div class="fl clearfix" style="margin-right: 30px;margin-left: 8px;">
					<div class="ui-checkbox ui-checkbox2">
						<input type="checkbox" checked="checked" name="expensesrate" class="huaBaoTXt0" value="">
						<label></label>
					</div>
					<span>T+1</span>
				</div>
				<div class="fl clearfix" style="margin-right: 30px;">
					<div class="ui-checkbox ui-checkbox2">
						<input type="checkbox" name="expensesrate" class="huaBaoTXt4" value="">
						<label></label>
					</div>
					<span>T+4</span>
				</div>
				<div class="fl clearfix" style="margin-right: 30px;">
					<div class="ui-checkbox ui-checkbox2">
						<input type="checkbox" name="expensesrate" class="huaBaoTXt7" value="">
						<label></label>
					</div>
					<span>T+7</span>
				</div>
			</div>

			<div class="form-group">
				<label class="control-label"><span class="text-label">服务费：</span><span id="poundage">0</span>(华宝)</label>
			</div>
			<div class="form-group">
				<label class="control-label"><span class="text-label">预计到账数量：</span><span id="has">0</span></label>
			</div>
			<div class="form-group">
				<label class="control-label"><span class="text-label">银行卡号：</span>
							<select id="J_score">
									<option v-for="v in banklist" :value="v.bankCardId">({{v.bankName}}){{v.accNo.substr(v.accNo.length-4,v.accNo.length)}}</option>
							</select>
							</label>
			</div>
			<div class="form-group">
				<label class="control-label"><span class="text-label">交易密码：</span>
									<input type="text" onfocus="this.type='password'" maxlength="6" fruit="true" autocomplete="off" name="password" data-target="#passwordTips" aria-required="true">
								</label>
				<a class="ZZHT-f999" href="../Usercenter/7-1.html" style="font-size: 12px;">忘记密码？</a>
				<span id="passwordTips"></span>
			</div>
			<!--<button class="sure_btn confirm_pay">确认</button>-->
		</form>
	</div>
</div>
<script type="text/javascript">
	var vm = new Vue({
		el: '#J_score',
		data: {
			banklist: [],
		}
	});
	$.ajax({ //获取记录列表
		type: "get",
		url: SURL + "usersBankcards/selectUserBranklist",
		data: {
			"userId": localStorage.userId,
		},
		dataType: 'json',
		success: function(res) {
			if(res.entity.length > 0) {
				vm.banklist = res.entity;
			} else {
				layer.alert('请先绑定银行卡');
			}
		}
	});

	$(function() {
		$.ajax({ //获取用户信息 余额
			type: "get",
			url: SURL + "webAccount/getAccountByUserId",
			data: {
				"userId": localStorage.userId,
			},
			dataType: 'json',
			success: function(res) {
				console.log(res);
				if(res.messageCode == 200) {
					$('.kaiyuan').html(res.entity.kaiyuan);
				} else {
					layer.msg(res.message);
				}
			}
		});

		$.ajax({ //赎回回显
			type: "get",
			url: SURL + "usersDraws/clickRedeem",
			data: {
				"userId": localStorage.userId,
				"type": 1
			},
			dataType: 'json',
			success: function(res) {
				$('.huaBaoTXt0').val(res.entity.huaBaoTXt0);
				$('.huaBaoTXt4').val(res.entity.huaBaoTXt4);
				$('.huaBaoTXt7').val(res.entity.huaBaoTXt7);
				console.log(res);

				$("input[name=money1]").change(function() {
					var expensesrate = $("input[name=expensesrate][checked=checked]").val();
					var taxRatio = res.entity.taxRatio;
					var totalPoundage = $(this).val() * expensesrate * 0.01 + $(this).val() * taxRatio * 0.01;
					totalPoundage = totalPoundage * 100;
					totalPoundage = totalPoundage.toFixed(2);
					var totalhuabao = $(this).val() * 100;
					if(totalPoundage) {} else {
						totalPoundage = 0;
						totalhuabao = 0;
						has = 0;
					}
					$('#huabao').text(totalhuabao);
					$('#poundage').text(totalPoundage);
					var has = (totalhuabao - totalPoundage) / 100;
					$('#has').text(has);
					depositForm(expensesrate, parseFloat(res.entity.taxRatio), '', '', $('.kaiyuan').html(), '')
				})
				$('.ui-checkbox label').click(function() {
					var expensesrate = $(this).prev().val();
					var taxRatio = res.entity.taxRatio;
					var money = $("input[name=money1]").val();
					var totalhuabao = money * 100;
					var totalPoundage = (money * expensesrate * 0.01 + money * taxRatio * 0.01) * 100;
					totalPoundage = totalPoundage.toFixed(2);
					var has = (totalhuabao - totalPoundage) / 100;
					if(totalPoundage) {} else {
						totalPoundage = 0;
						totalhuabao = 0;
						has = 0;
					}
					$('#poundage').text(totalPoundage);
					$('#huabao').text(totalhuabao);
					$('#has').text(has);
					depositForm(expensesrate, parseFloat(res.entity.taxRatio), '', '', $('.kaiyuan').html(), '')
				})
			}
		});

	})
</script>